package b1.conifg
{
	import Box2D.Common.Math.*;
	
	public class HotPoint
	{
		//类型：0, 圆形热点; 1, 多边形热点
		public var type:int;
		public var x:Number;
		public var y:Number;
		//动物图片的索引（用于嫌疑犯的显示）
		public var imageIndex:int;
		//作用半径
		public var r:Number;
		//线索索引
		public var clueIndex:int;
		//跌落的几率 
		public var dropPossibility:Number;
		
		//标识骨头运动的类型, 0向下,1向上
		public var reboundType:int;
		//动物动作类型
		public var animalReactionType:int;
		//多边形的顶点数组（多边形热点时起作用)
		public var vertices:Array;
		
		public function HotPoint(xmlStr:String = null)
		{
			vertices = new Array();
			if (xmlStr != null)
			{
				var hitPointStrs:Array = xmlStr.split(",");
				this.type = parseInt(hitPointStrs[0]);
				//圆形
				if (this.type == 0)
				{ 
					this.x = parseFloat(hitPointStrs[1]);
					this.y = parseFloat(hitPointStrs[2]);
					this.r = parseFloat(hitPointStrs[3]);
					this.reboundType = parseInt(hitPointStrs[4]);
					this.animalReactionType = parseInt(hitPointStrs[5]);
				}
				//多边形
				else
				{
					for (var j:int = 0; j < (hitPointStrs.length - 1) / 2; j++)
					{
						var vertex:b2Vec2 = new b2Vec2();
						vertex.x = parseFloat(hitPointStrs[1 + 2 * j]);
						vertex.y = parseFloat(hitPointStrs[2 + 2 * j]);
						this.vertices.push(vertex);
					}
				}
			}
		}

	}
}
